//
//  KABExhOrderTCell.m
//  kabu
//
//  Created by XiangDongMBP on 2017/2/21.
//  Copyright © 2017年 East. All rights reserved.
//

#import "KABExhOrderTCell.h"
#import "KABModel.h"
#import <YYWebImage.h>
#import "UIColor+XDHex.h"
#import "GlobalHeader.h"

@implementation KABExhOrderTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.checkOrderBtn.layer.masksToBounds = YES;
    self.checkOrderBtn.layer.borderWidth = 1;
    self.checkOrderBtn.layer.cornerRadius = CGRectGetHeight(self.checkOrderBtn.bounds) / 2.0;
    self.checkOrderBtn.layer.borderColor = [UIColor xd_colorWithHex:KABGlobalColorRedBtnBorderColor].CGColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configViewWithExhOrderDetail:(KABExhOrderDetail *)detail {
    self.orderNOLabel.text = [NSString stringWithFormat:@"订单  %@", detail.orderId];
    
    [self.coverImgView yy_setImageWithURL:[NSURL URLWithString:detail.exhibition_cover_image_url]
                               placeholder:[KABDefaultVarModel sharedInstance].smallDefaultImg];
    
    self.exhTitleLabel.text = detail.exhibition_name;
    self.priceLabel.text = [NSString stringWithFormat:@"￥%.2f x%zd", detail.price / 100.0, detail.number];
    self.totalLabel.text = [NSString stringWithFormat:@"总价：￥%.2f", detail.total_price / 100.0];
    
    self.timeLabel.text = detail.create_time;
    self.proPriLabel.hidden = YES;
}

@end


@implementation KABExhOrderTCell (ExhibitionOrderDetail)
- (void)configDetailViewWithExhDetail:(KABExhOrderDetail *)detail {
    self.orderNOLabel.text = [NSString stringWithFormat:@"订单  %@", detail.orderId];
    
    [self.coverImgView yy_setImageWithURL:[NSURL URLWithString:detail.exhibition_cover_image_url]
                              placeholder:[KABDefaultVarModel sharedInstance].smallDefaultImg];
    
    self.exhTitleLabel.text = detail.exhibition_name;
    self.priceLabel.text = [NSString stringWithFormat:@"￥%.2f x%zd", detail.price / 100.0, detail.number];
    self.totalLabel.text = [NSString stringWithFormat:@"总价：￥%.2f", detail.total_price / 100.0];
    self.totalLabel.hidden = YES;
    
    self.timeLabel.text = @"商品金额";
    self.checkOrderBtn.hidden = YES;
    self.proPriLabel.hidden = NO;
    self.proPriLabel.text = [NSString stringWithFormat:@"￥%.2f", detail.total_price / 100.0];
}

@end
